package pl.dream.team.dao;

import java.util.List;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

import pl.dream.team.dao.intf.InscriptionDao;
import pl.dream.team.domain.Inscription;

@Stateless
public class InscriptionDaoImpl implements InscriptionDao{

	@PersistenceContext(name ="pu")
	EntityManager entityManager;
	
	@SuppressWarnings("unchecked")
	@Override
	public List<Inscription> findInscriptions() {
		Query query = entityManager.createQuery("select i from Inscription i");
		return query.getResultList();
	}

	@Override
	public void addInscription(Inscription inscription) {
		entityManager.persist(inscription);
	}
}
